Database2 (DB2) is a relational database management system (DBMS). DB2 provides an open database environment that runs on a wide variety of computing platforms, including mainframes and large distributed platforms to smaller scale personal computers. Using Structured Query Language (SQL), users may create and edit tables in the DB2 to assess and manipulate data. An SQL query may cause DB2 to use existing workfiles, and if necessary create new workfiles to cater to the result set returned by the query. A workfile is a temporary storage area that that is generally created to store intermediate relations from SQL queries.
Workfiles containing a few hundred of data sets may be common in large databases. In DB2 v8, a capacity for all workfiles in a database is predefined, generally by a system programmer. Any user query requesting workfiles that exceed the predefined capacity fail in DB2 v8. However, in the DB2 v10 architecture, workfiles are defined with a secondary space that enables the workfiles to extend beyond a predefined capacity. While this feature allows for more workfile scalability, it also presents new problems. For instance, runaway queries requiring excessive workfiles may end up consuming all available disk space which, in turn, may cause transaction failures. Thus, there is a need for a system and method for monitoring workfile usage, alerting system programmers when a workfile threshold has been reached, and reclaiming disk space.